Skip to content

Conversation

@rzr
Copy link
Collaborator

@rzr rzr commented Sep 18, 2025

This feature was not delivered on zpc-1.7.0

Relate-to: SiliconLabs/UnifySDK#43

Change

Ongoing parallel implementation of CC

zwave-unify-u3c-20240501

Supported features

  • Add, Edit, Remove an User (ZPC and MQTT)
  • Add, Edit, Remove an Credential (ZPC and MQTT)
  • End device interview of capabilities (ZPC and MQTT)
  • Support Set User/Credential Report Error

Incoming (not in PR yet, but implemented)

  • Handle multiple deletion of Users/Credentials
  • Credential Learn
  • User Unique Identifier Credential Association
  • User Checksum
  • Credential Checksum

WIP

  • Log errors in MQTT (and DevUI)

How to test it

End device

You can use the simulated environment to have an end device that support User Credential : https://github.com/Z-Wave-Alliance/z-wave-stack/wiki/ZPC

Controller

Compile (tested on Ubuntu 22.04 WSL)

In the git repository :

# We need mosquitto in the system
uic> sudo apt install mosquitto

# Build docker container
uic> docker/build_docker.sh amd64 uic_amd64;
# Start docker container 
uic> docker run -it -v $PWD:$PWD -w $PWD uic_amd64;

# Now we are in the docker container, create build folder
docker> mkdir build && cd build

# Create Makefile with only ZPC and DevUI
docker> cmake .. -GNinja -DBUILD_AOXPC=OFF -DBUILD_CPCD=OFF -DBUILD_EMD=OFF -DBUILD_EPC=OFF -DBUILD_GMS=OFF -DBUILD_IMAGE_PROVIDER=OFF -DBUILD_MATTER_BRIDGE=OFF -DBUILD_NAL=OFF -DBUILD_OTBR=OFF -DBUILD_POSITIONING=OFF -DBUILD_TESTING=OFF -DBUILD_UIC_DEMO=OFF -DBUILD_UPTI_CAP=OFF -DBUILD_UPTI_WRITER=OFF -DBUILD_UPVL=OFF -DBUILD_ZIGBEED=OFF -DBUILD_ZIGPC=OFF

# Compile 
docker> ninja

# Create .deb packages if you want to install them on your machine
docker> ninja package

Once compiled, you can either install the dev packages or start the manually :

# ZPC start 
#⚠️--zpc.serial might change based on your socat implementation)
uic> sudo build_amd64/applications/zpc/zpc  --zpc.serial=/tmp/socat-localhost+4901 --zpc.datastore_file /tmp/simulated.db --mapdir ./applications/zpc/components/dotdot_mapper/rules/ --log.tag_level zwave_command_class_user_credential:d,dotdot_mqtt:d,user_credential_cluster_server:d,zwave_command_class_notification:d; 

# Dev UI API
#⚠️ You'll need node 18+ (use nvm https://github.com/nvm-sh/nvm) 
uic> cd applications/dev_ui/dev_gui
uic> npm run start-api

# Dev UI (https://localhost:3000)
#⚠️ You'll need node 18+ (use nvm https://github.com/nvm-sh/nvm) 
#⚠️ Security issues may happen with firefox, you'll have to test it on Chronium or use the .deb package
uic> cd applications/dev_ui/dev_gui
uic> npm run start

Run

We recommend to start zpc in command line : https://siliconlabs.github.io/UnifySDK/applications/zpc/readme_user.html#running-zpc-from-the-command-line

With the following arguments to help us debug an issue :
--log.tag_level zwave_command_class_user_credential:d,user_credential_cluster_server:d,zwave_command_class_notification:d;

⚠️ Make sure that this file SiliconLabs/UnifySDK@924445b#diff-69a45f32ef895eeb999e643981807b60127f9a119499c6c83729312d66824544 is in your --mapdir directory (default path : /usr/share/uic/rules)

Once the end device is included you can see the User Credential class in : https://localhost:3080/usercredential

⚠️Default credential data should not display properly, this is a known issue in the end device and will be fixed soon.

Screenshots

image
image

Related-to: https://github.com/Z-Wave-Alliance/OSWG/issues/21#issuecomment-2074462819

Checklist

Checklist

@rzr rzr marked this pull request as draft September 22, 2025 13:32
@DucAnh-silabs
Copy link

DucAnh-silabs commented Sep 25, 2025

I've tested the User Credentials CC using MQTT+ ZPC:

Setup

  • EN: BRD2705A (XG28) + 2025.6.1
  • Controller: ZGM230S + 2025.6.1

Tests

  • Add, Edit, Remove an User (ZPC and MQTT)
  • Add, Edit, Remove an Credential (ZPC and MQTT)
  • Remove All Credentials/Users (ZPC and MQTT)

Verification

  • Successfully change Attribute value
  • Zniffer shows commands successfully being sent and there are reports with correct state.

MQTT topics and payloads

ucl/by-unid/+/+/UserCredential/Commands/AddUser

{
      "UserUniqueID": 15,
      "UserType": "ProgrammingUser",
      "UserActiveState": false,
      "CredentialRule": "Single",
      "UserName": "MARCEL TURBO",
      "ExpiringTimeoutMinutes": 0,
      "UserNameEncoding": "ASCII"
}

ucl/by-unid/+/+/UserCredential/Commands/ModifyUser

{
      "UserUniqueID": 12,
      "UserType": "ProgrammingUser",
      "UserActiveState": true,
      "CredentialRule": "Dual",
      "UserName": "NEW ENGINE V12",
      "ExpiringTimeoutMinutes": 0,
      "UserNameEncoding": "ASCII"
}

ucl/by-unid/+/+/UserCredential/Commands/DeleteUser

{
      "UserUniqueID": 3
}

ucl/by-unid/+/+/UserCredential/Commands/AddCredential

{
      "UserUniqueID": 12,
      "CredentialType": "PINCode",
      "CredentialSlot": 1,
      "CredentialData": "1234"
}

ucl/by-unid/+/+/UserCredential/Commands/ModifyCredential

{
      "UserUniqueID": 12,
      "CredentialType": "PINCode",
      "CredentialSlot": 5,
      "CredentialData": "1234"
}

ucl/by-unid/+/+/UserCredential/Commands/DeleteCredential

{
      "UserUniqueID": 12,
      "CredentialType": "PINCode",
      "CredentialSlot": 1
}

ucl/by-unid/+/+/UserCredential/Commands/DeleteAllUsers

{}

ucl/by-unid/+/+/UserCredential/Commands/DeleteAllCredentials

{}

@rzr rzr marked this pull request as ready for review September 25, 2025 10:24
@rzr rzr changed the title WIP: User credentials Command Class User credentials Command Class Sep 26, 2025
@rzr
Copy link
Collaborator Author

rzr commented Oct 6, 2025

Please also review, to rebase on it, test could be also implemented for u3c based on above script

@rzr rzr force-pushed the phcoval/cc/cred/review/main branch from 0dbdd41 to 6050926 Compare October 9, 2025 07:48
rzr added a commit to rzr/z-wave-protocol-controller that referenced this pull request Oct 9, 2025
Feel free to stress test by doing negative testing and changes
usernames (using spaces or escapes).

May delete commands produce retained events.

Further negative testing will not hurt.

Relate-to: SiliconLabsSoftware#144
Signed-off-by: Philippe Coval <[email protected]>
@rzr rzr requested a review from silabs-JulienT October 13, 2025 15:37
rzr and others added 20 commits October 13, 2025 17:39
- User Capabilities
- Credential Capabilities
- All User Checksum
- User Get/Report
- Credential Get/Report

Merged :
UIC-3222: Fix Supported Credential Types
UIC-3222: Ignore User ID 0 & don't create duplicates
UIC-3222: Delayed interview
UIC-3222: User Credential User Name Encoding under UUID (No real advantage to put this under USER_NAME)
UIC-3222: Fix user discovery
UIC-3222: Credential get log
UIC-3222: Discovery fix (credential and user get)
UIC-3222: Discovery interview remove all users before user interview
UIC-3222: Fix credential report if credential data is missing
UIC-3222: Remove user if User modifier type is DNE
UIC-3222: Correctly remove all user credential before discovery
UIC-3222: set_reported_attribute return correct status and undefined desired
UIC-3222: Add get_desired user id node function
UIC-3222: get_credential_type can now be searched as desired value
UIC-3222: Credential Learn Properties

[Philippe Coval]

Adjusted crc16 in applications/zpc/components/zwave_command_classes/test/CMakeLists.txt
UIC-3222: Credential Set on Credential Operation Type
UIC-3222: Set Credential (delete) improvement
UIC-3222: Credential SET also look in desired values

UIC-3222: Fix delete operation on Credential SET
UIC-3222: Allow extra bytes when testing set/get commands
UIC-3222: User set on User Operation Type
UIC-3222: More user types
UIC-3222: User SET fix
UIC-3222: Set User (delete) improvement
UIC-3222: Fix expiring minutes to Desired Or Reported to allow add
UIC-3222: User SET can look into desired attributes
UIC-3222: Expose New credential capabilities
UIC-3222: Expose Admin Code

[Philippe Coval]

Adjusted applications/zpc/components/zwave_command_classes/test/CMakeLists.txt
This patch will :
- Not delete all user database en Unify startup
- Allow the user to re-initiate an interview with the device and discover again all users
Also remove credential if modifier type is DNE
UIC-3222: Documentation of delete all credentials
In the previous implementation of U3C, User Notification Report size was incorrect : Z-Wave-Alliance/z-wave-stack#409
This commit use the correct implementation.
This commit will ensure that no more than Credential Type/Credential Slot exists no matter the user that got it. If we have (1,1) credential for User 1, user 2 cannot have a credential with type 1 and slot 1. User 2 should have type 1 and slot 2.

For more context see Z-Wave-Alliance/AWG#172
Verify that the slot we are trying to add is in range of supported slots
silabs-borisl and others added 28 commits October 13, 2025 17:39
We don't use desired state for credential type anymore since it's add complexity without any needs for it.
This will make the User Credential Implementation clearer
Add a new helper class for clarity
Much simpler and more efficient thanks to change parent feature
Top level API is now available directly with an header to avoid base file to be too big
Use new C++ api to be more consistent
0 nodes are better handled
Credential node are properly deleted when no credential is available
Only check reported value instead of desired and reported
Updated test to better coverage USER_SET
…rules

Works both when adding a credential and modifying it
Use a new callback mechanism that allows the server to listen to certain event
Add a notification to the UI
Set the received checksum last
Allow to add an credential that is already in the node tree
Check desired or reported value of CREDENTIAL_LEARN_OPERATION_TYPE to avoid issues with supervision
Send status to mqtt
Now the attribute ALL_USERS_CHECKSUM is defined at the end of the User interview if device support it
Add command to force the refresh of the checksum
Now correctly interview ALL users on the first discovery (previously was only checking the first one due to a resolution error)
All user checksum happens after all users & all credentials are reported
Feel free to stress test by doing negative testing and changes
usernames (using spaces or escapes).

May delete commands produce retained events.

Further negative testing will not hurt.

Relate-to: SiliconLabsSoftware#144
Signed-off-by: Philippe Coval <[email protected]>
@rzr rzr force-pushed the phcoval/cc/cred/review/main branch from 6050926 to 20ea338 Compare October 13, 2025 15:40
@rzr rzr merged commit 3b23847 into SiliconLabsSoftware:main Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants